$OpenBSD: patch-configure_in,v 1.3 2006/01/02 20:05:09 sturm Exp $
--- configure.in.orig	Sat Jun 15 22:41:53 2002
+++ configure.in	Mon Jan  2 20:59:02 2006
@@ -601,42 +601,6 @@ AC_SUBST(TCLINCLUDE)
 AC_SUBST(TCLPACKAGEDIR)
 AC_SUBST(TCLBIN)
 
-# ----------------------------------------------------------------
-#  PDFlib auxiliary library: TIFFlib
-#  We bring our own copy of tifflib but the client may choose to
-#  use an installed one instead. This is only support for C/C++ clients.
-# ----------------------------------------------------------------
-
-# The list of Makefile targets for our internal libraries
-LIBTARGETS=""
-INTERNALLIBS=""
-
-WITH_INTERNALTIFFLIB="yes"
-TIFFLIBINC=""
-EXTERNALLIBS="$MATHLIB"
-
-AC_ARG_WITH(tifflib,
-[  --with-tifflib          use installed tifflib instead of internal (not rec.)],
-[
-    AC_CHECK_LIB(tiff, TIFFOpen, [EXTERNALLIBS="$EXTERNALLIBS -ltiff"],
-	AC_MSG_ERROR([No usable tifflib library found.]))
-
-    AC_CHECK_HEADER(tiff.h, , 
-	AC_MSG_ERROR([No usable tifflib include file found.]))
-
-    AC_MSG_RESULT([         Note: user-supplied tifflib - language bindings disabled])
-    WITH_INTERNALTIFFLIB="no"
-],[
-    AC_C_BIGENDIAN()
-
-    TIFFLIBINC="-I../tiff"
-    INTERNALLIBS="$INTERNALLIBS \$(top_builddir)/tiff/libtiff.la"
-    LIBTARGETS="$LIBTARGETS libtiff"
-    GENERATED_FILES="$GENERATED_FILES tiff/Makefile"
-])
-
-AC_SUBST(TIFFLIBINC)
-
 # ----------------------------------------------------------------------
 #  PDFlib auxiliary library: Zlib
 #  We bring our own copy of zlib but the client may choose to
@@ -685,7 +649,8 @@ AC_ARG_WITH(pnglib,
     dnl Make sure libpng sits in front of libz
     AC_CHECK_LIB(png, png_create_read_struct,
 	[EXTERNALLIBS="-lpng $EXTERNALLIBS"],
-	AC_MSG_ERROR([No usable pnglib library found.]))
+	AC_MSG_ERROR([No usable pnglib library found.]),
+	$EXTERNALLIBS)
 
     AC_CHECK_HEADER(png.h, , 
 	AC_MSG_ERROR([No usable pnglib include file found.]))
@@ -707,6 +672,56 @@ AC_ARG_WITH(pnglib,
 AC_SUBST(PNGLIBINC)
 
 # ----------------------------------------------------------------
+#  PDFlib auxiliary library: TIFFlib
+#  We bring our own copy of tifflib but the client may choose to
+#  use an installed one instead. This is only support for C/C++ clients.
+# ----------------------------------------------------------------
+
+# The list of Makefile targets for our internal libraries
+LIBTARGETS=""
+INTERNALLIBS=""
+
+WITH_INTERNALTIFFLIB="yes"
+TIFFLIBINC=""
+EXTERNALLIBS="$EXTERNALLIBS $MATHLIB"
+
+AC_ARG_WITH(tifflib,
+[  --with-tifflib          use installed tifflib instead of internal (not rec.)],
+[
+    if test "$WITH_INTERNALZLIB" = "yes"; then
+	AC_MSG_ERROR([--with-tifflib requires --with-zlib])
+    fi
+
+    AC_CHECK_LIB(jpeg, jpeg_read_header,
+	[EXTERNALLIBS="-ljpeg $EXTERNALLIBS"])
+
+    dnl Make sure libtiff sits in front of libz
+    AC_CHECK_LIB(tiff, TIFFOpen,
+	[EXTERNALLIBS="-ltiff $EXTERNALLIBS"],
+	AC_MSG_ERROR([No usable tifflib library found.]),
+	$EXTERNALLIBS)
+
+    AC_CHECK_HEADER(tiff.h, , 
+	AC_MSG_ERROR([No usable tifflib include file found.]))
+
+    AC_MSG_RESULT([         Note: user-supplied tifflib - language bindings disabled])
+    WITH_INTERNALTIFFLIB="no"
+],[
+    if test "$WITH_INTERNALZLIB" = "no"; then
+	AC_MSG_ERROR([--with-zlib requires --with-tifflib])
+    fi
+
+    AC_C_BIGENDIAN()
+
+    TIFFLIBINC="-I../tiff"
+    INTERNALLIBS="$INTERNALLIBS \$(top_builddir)/tiff/libtiff.la"
+    LIBTARGETS="$LIBTARGETS libtiff"
+    GENERATED_FILES="$GENERATED_FILES tiff/Makefile"
+])
+
+AC_SUBST(TIFFLIBINC)
+
+# ----------------------------------------------------------------
 #  PDFlib auxiliary library: PDI (PDF import library)
 # ----------------------------------------------------------------
 
@@ -934,7 +949,7 @@ if test "$WITH_SHARED" = "no"; then
     RPATH=""
 else
     dnl we generate both static and shared libs
-    RPATH="-rpath \$(libdir) -version-info $LTVERSIONINFO"
+    RPATH="-rpath \$(libdir) \$(LIBpdf_LTVERSION)"
 
 fi
 
